<?php

class Nuo_Validator_Email extends Nuo_Validator_Abstract
{
	/**
	 * @var array
	 */
	public $_config = array('msg' => 'Invalid email address');

	const PATTERN = '/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/';
	
	/**
	 * @param $mixed $value value to test
	 * @param array $params
	 * @return bool
	 */
	 
	public function isValid($value, $params = null)
	{
		if (is_string($value) && $value)
		{
			return preg_match(self::PATTERN, $value);
		}
		return FALSE;
	}

}
